
package battleAttr

import "sanguo/node/common/GlobalConstData"

type Info struct{
	Min       int32
	Max       int32
	NeedFixed bool
}

var idxToName map[int32]string
var BattleAttrInfo map[int32]Info

const(
	Attack = 0 //攻击力
	AttackPower = 1 //攻击强度
	Defenses = 2 //防御力
	DefensesPower = 3 //防御强度
	HitPoint = 4 //生命值
	HPPower = 5 //生命强度
	ElementalDefenses = 6 //元素防御
	ElementalDefensesPower = 7 //元素防御强度
	ArmorPoiseHealth = 8 //霸体值
	PoiseDamage = 9 //破甲值
	PoiseDamagePower = 10 //破甲加成
	MovementSpeed = 11 //移动速度
	MovementSpeedPower = 12 //移动速度加成
	AwakenEnergy = 13 //觉醒能量
	AwakenEnergyGain = 14 //觉醒获取值
	AwakenEnergyGainSpeed = 15 //觉醒获取速率
	AwakenEnergyCost = 16 //觉醒消耗值/秒
	AwakenEnergyLessCost = 17 //觉醒消耗
	MusouEnergy = 18 //无双能量
	MusouEnergyGain = 19 //无双获取值
	MusouEnergyGainSpeed = 20 //无双获取速率
	CritChance = 21 //暴击率
	CritPower = 22 //暴击倍率
	CritDamage = 23 //暴击伤害
	DamagePower = 24 //伤害加成
	DefensesReduction = 25 //伤害减免
	FireAttack = 26 //火焰伤害
	FireAttackPower = 27 //火焰伤害加成
	IceAttack = 28 //冰霜伤害
	IceAttackPower = 29 //冰霜伤害加成
	LightningAttack = 30 //闪电伤害
	LightningAttackPower = 31 //闪电伤害加成
	AttackPowerToAir = 32 //对浮空敌人伤害加成
	AttackPowerToFall = 33 //对倒地敌人伤害加成
	AttackPowerToHumanGrass = 34 //对普通怪物伤害加成
	AttackPowerToInfernal = 35 //对精英怪物伤害加成
	AttackPowerToBoss = 36 //对首领怪物伤害加成
	PhysicalResistance = 37 //物理抵抗
	ElementalResistance = 38 //元素抵抗
	MusouAttack = 39 //无双附加伤害
	MusouAttackPower = 40 //无双伤害加成
	AwakenAttack = 41 //觉醒附加伤害
	AwakenAttackPower = 42 //觉醒伤害加成
	ExpPower = 43 //经验加成
	GoldPower = 44 //星币加成
	CritAllResistance = 45 //暴击抵抗
	SkillEnergy = 46 //技能能量
	SkillEnergyGainSpeed = 47 //技能获取速率
	AttrMax = 48
)

func init() {	
	idxToName = map[int32]string{}
	BattleAttrInfo = map[int32]Info{}
	idxToName[0] = "Attack"
	idxToName[1] = "AttackPower"
	idxToName[2] = "Defenses"
	idxToName[3] = "DefensesPower"
	idxToName[4] = "HitPoint"
	idxToName[5] = "HPPower"
	idxToName[6] = "ElementalDefenses"
	idxToName[7] = "ElementalDefensesPower"
	idxToName[8] = "ArmorPoiseHealth"
	idxToName[9] = "PoiseDamage"
	idxToName[10] = "PoiseDamagePower"
	idxToName[11] = "MovementSpeed"
	idxToName[12] = "MovementSpeedPower"
	idxToName[13] = "AwakenEnergy"
	idxToName[14] = "AwakenEnergyGain"
	idxToName[15] = "AwakenEnergyGainSpeed"
	idxToName[16] = "AwakenEnergyCost"
	idxToName[17] = "AwakenEnergyLessCost"
	idxToName[18] = "MusouEnergy"
	idxToName[19] = "MusouEnergyGain"
	idxToName[20] = "MusouEnergyGainSpeed"
	idxToName[21] = "CritChance"
	idxToName[22] = "CritPower"
	idxToName[23] = "CritDamage"
	idxToName[24] = "DamagePower"
	idxToName[25] = "DefensesReduction"
	idxToName[26] = "FireAttack"
	idxToName[27] = "FireAttackPower"
	idxToName[28] = "IceAttack"
	idxToName[29] = "IceAttackPower"
	idxToName[30] = "LightningAttack"
	idxToName[31] = "LightningAttackPower"
	idxToName[32] = "AttackPowerToAir"
	idxToName[33] = "AttackPowerToFall"
	idxToName[34] = "AttackPowerToHumanGrass"
	idxToName[35] = "AttackPowerToInfernal"
	idxToName[36] = "AttackPowerToBoss"
	idxToName[37] = "PhysicalResistance"
	idxToName[38] = "ElementalResistance"
	idxToName[39] = "MusouAttack"
	idxToName[40] = "MusouAttackPower"
	idxToName[41] = "AwakenAttack"
	idxToName[42] = "AwakenAttackPower"
	idxToName[43] = "ExpPower"
	idxToName[44] = "GoldPower"
	idxToName[45] = "CritAllResistance"
	idxToName[46] = "SkillEnergy"
	idxToName[47] = "SkillEnergyGainSpeed"
	BattleAttrInfo[0] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[1] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[2] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[3] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[4] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[5] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[6] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[7] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[8] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[9] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[10] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[11] = Info{
		Min: 0,
		Max: 20,
		NeedFixed: false,
	}
	BattleAttrInfo[12] = Info{
		Min: 0,
		Max: 30000,
		NeedFixed: true,
	}
	BattleAttrInfo[13] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[14] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[15] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[16] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[17] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[18] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[19] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[20] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[21] = Info{
		Min: 0,
		Max: 10000,
		NeedFixed: true,
	}
	BattleAttrInfo[22] = Info{
		Min: 0,
		Max: 30000,
		NeedFixed: true,
	}
	BattleAttrInfo[23] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[24] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[25] = Info{
		Min: 0,
		Max: 10000,
		NeedFixed: true,
	}
	BattleAttrInfo[26] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[27] = Info{
		Min: 0,
		Max: 30000,
		NeedFixed: true,
	}
	BattleAttrInfo[28] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[29] = Info{
		Min: 0,
		Max: 30000,
		NeedFixed: true,
	}
	BattleAttrInfo[30] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[31] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[32] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[33] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[34] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[35] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[36] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[37] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[38] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[39] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[40] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[41] = Info{
		Min: 0,
		Max: 9999999,
		NeedFixed: false,
	}
	BattleAttrInfo[42] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[43] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[44] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
	BattleAttrInfo[45] = Info{
		Min: 0,
		Max: 9999,
		NeedFixed: true,
	}
	BattleAttrInfo[46] = Info{
		Min: 0,
		Max: 999,
		NeedFixed: false,
	}
	BattleAttrInfo[47] = Info{
		Min: 0,
		Max: 100000,
		NeedFixed: true,
	}
}


func GetNameById(id int32) string {
	return idxToName[id]
}

func TransFormToFloat64(id, value int32) float64 {
	info, ok := BattleAttrInfo[id]
	if !ok {
		return 0
	}

	if info.NeedFixed {
		v := float64(float64(value) / float64(GlobalConstData.BattleAttrRate))
		return v
	}
	return float64(value)
}
